﻿CREATE PROCEDURE Brand_GetCategories
	@brandId int
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;
	SELECT DISTINCT
	  dbo.Categories.Title,
	  dbo.Categories.CategoryId
	FROM
	  dbo.Products
	  INNER JOIN dbo.Categories ON (dbo.Products.CategoryId = dbo.Categories.CategoryId)
	WHERE
	  (dbo.Products.BrandId = @brandId)
	ORDER BY
	  dbo.Categories.CategoryId
END


